import threading as td
import time
from queue import Queue

def job(x,f):
    for i in x:
        #time.sleep(0.00001)
        f.write(str(i) + '\n')
        #print(i)

def start():
    threads = []
    time1 = time.time()
    with open(r'C:\Users\Administrator\Desktop\zz.txt', 'a+') as book:
        for i in range(10):
            t = td.Thread(target=job, args=(q.get(), book))
            threads.append(t)
            t.start()
        #for i in threads:
            #i.start()
        for i in threads:
            i.join()
        time2 = time.time()
        print(time2 - time1)

def job2(q):
    for i in range(10):
        data = list(range(10000* i, (i + 1) * 10000))
        q.put(data)

if __name__ == '__main__':
    q = Queue()
    job2(q)
    start()
